import React from 'react';
import { Redirect } from 'react-router-dom';
// 导入 布局组件
// 一级路由 音乐馆组件
const Musicclub = React.lazy(_ => import("../pages/musicclub"))

// MusicClub的二级路由
// MusicClub的 首页(二级路由)
const MusicClubHome = React.lazy(_ => import("../pages/musicclub/home"))
const MusicClubSinger = React.lazy(_ => import("../pages/musicclub/singer"))
const MusicClubAlbum = React.lazy(_ => import("../pages/musicclub/album"))
const MusicClubTopList = React.lazy(_ => import("../pages/musicclub/toplist"))
const MusicClubCategory = React.lazy(_ => import("../pages/musicclub/category"))
const MusicClubRadio = React.lazy(_ => import("../pages/musicclub/radio"))
const MusicClubMvList = React.lazy(_ => import("../pages/musicclub/mvList"))



// 一级路由 我的音乐组件
const MyMusic = React.lazy(_ => import("../pages/myMusic"))
const Pc = React.lazy(_ => import("../pages/pc"))
const Open = React.lazy(_ => import("../pages/open"))
const Vip = React.lazy(_ => import("../pages/VIP"))
// 搜索页面
const Search = React.lazy(_ => import("../pages/musicclub/search"))

// 播放页
const Player = React.lazy(_ => import("../pages/player"))



const routes = [
  {
    path: "/",
    exact: true,
    render: () => (<Redirect to="/musicClub" />)
  },
  // 音乐馆
  {
    path: "/musicClub",
    component: Musicclub,
    // 音乐馆的二级路由
    routes: [
      {
        path: "/musicClub",
        exact: true,
        render: () => (<Redirect to="/musicClub/index" />),
      },


      { path: "/musicClub/index", component: MusicClubHome }, // 这就是音乐馆下的 首页
      { path: "/musicClub/singer", component: MusicClubSinger },
      { path: "/musicClub/album", component: MusicClubAlbum },
      { path: "/musicClub/toplist", component: MusicClubTopList },
      { path: "/musicClub/category", component: MusicClubCategory },
      { path: "/musicClub/radio", component: MusicClubRadio },
      { path: "/musicClub/mvList", component: MusicClubMvList },

    ]
  },
  // 我的音乐
  {
    path: "/myMusic",
    component: MyMusic
  },
  {
    path: "/pc",
    component: Pc
  },
  {
    path: "/open",
    component: Open
  },
  {
    path: "/vip",
    component: Vip
  },
  {
    path: "/player/:id",
    exact: true,
    component: Player
  },
  { path: "/search", component: Search },
]
export default routes;